/*
 * Copyright 2018 The Data Transfer Project Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.datatransferproject.transfer.microsoft.transformer;

import java.util.List;

/** Provides facilities for performing recursive transformations and collated error reporting. */
public interface TransformerContext {

  /**
   * Transform the input instance into an instance of a result type.
   *
   * <p>This method supports null input values; if the input is null, the same will be returned.
   *
   * @param resultType the type to transform to
   * @param input the input instance
   */
  <T> T transform(Class<T> resultType, Object input);

  /**
   * Returns the property value for the key or null.
   *
   * @param key the key
   */
  String getProperty(String key);

  /**
   * Sets the property.
   *
   * @param key the key
   * @param value the value
   */
  void setProperty(String key, String value);

  /**
   * Adds a problem to the current processing context.
   *
   * @param message the problem
   */
  void problem(String message);

  /** Returns problems encountered during transformation. */
  List<String> getProblems();
}
